#include "mainwindow.h"#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); QObject::connect(ui->newButton,SIGNAL(clicked()),this,SLOT(on_newButton_clicked())); //QObject::connect(ui->browserFileToolButton,SIGNAL(clicked()),this,SLOT(on_browserFileToolButton_clicked())); QObject::connect(ui->procListWidget,SIGNAL(itemSelectionChanged()),this,SLOT(itemTextSolt()));}MainWindow::~MainWindow(){ delete ui;}void MainWindow::on_newButton_clicked(){ HANDLE hSnapProcess = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if(INVALID_HANDLE_VALUE == hSnapProcess) { QMessageBox::information(this,"ERROR","Error when create snapshot !"); return; } PROCESSENTRY32 pe; pe.dwSize = sizeof (pe); if(FALSE == Process32First(hSnapProcess,&pe)) { QMessageBox::information(this,"ERROR","Error when Process32First !"); return; } while(Process32Next(hSnapProcess,&pe)) { //WCHAR ProcessName = pe.szExeFile; QString ProcessName = QString::fromWCharArray(pe.szExeFile); //ui->procTextEdit->append(ProcessName); //QString ProcessID = pe.th32ProcessID; int ProcessID = (int)pe.th32ProcessID; ui->procListWidget->addItem("PID[" QString::number(ProcessID) "] " ProcessName); //qDebug()<<ui->procListWidget->currentItem()->text(); }}void MainWindow::on_browserFileToolButton_clicked(){ dllName = QFileDialog::getOpenFileName(this,"open file",QDir::currentPath()); if(dllName.isEmpty()) { QMessageBox::information(this,"ERROR","Open Dll Failed , Please Select Again !"); } ui->dllNameLineEdit->setText(dllName);}void MainWindow::itemTextSolt(){ //qDebug()<<ui->procListWidget->currentItem()->text(); QString ProInfo = ui->procListWidget->currentItem()->text(); //QStringList ProInfoList = ProInfo.split("["); QString stProID = ProInfo.split("[").at(1).split("]").at(0); //qDebug()<<stProID.toInt(); //qDebug()<<dllName; PrcoID=(DWORD)stProID.toDouble();}void MainWindow::on_injectButton_clicked(){ HANDLE hProHandle = OpenProcess(PROCESS_ALL_ACCESS,FALSE,PrcoID); //qDebug()<<hProHandle; if(hProHandle == NULL) { QMessageBox::information(this,"ERROR","Get PROCESS HANDLE FAILED !"); return; } LPVOID IpAdrr = VirtualAllocEx(hProHandle,NULL,0x1000,MEM_COMMIT,PAGE_EXECUTE_READWRITE); if(IpAdrr == NULL) { QMessageBox::information(this,"ERROR","Get IPADRR FAILED !"); return; } //qDebug()<<IpAdrr; char dllNameBuf[MAX_PATH] = {NULL}; strcpy(dllNameBuf,dllName.toLocal8Bit().data()); //qDebug()<<*dllNameBuf; bool ok = WriteProcessMemory(hProHandle,IpAdrr,dllNameBuf,strlen(dllNameBuf),NULL); if(!ok) { QMessageBox::information(this,"ERROR","Wirte dll name failed !"); } //qDebug()<<strlen(dllNameBuf) 1; //qDebug()<<dllNameBuf; //HMODULE hModule = LoadLibrary(TEXT("kernel32")); //qDebug()<<hModule; //LPTHREAD_START_ROUTINE pfThread = (LPTHREAD_START_ROUTINE)GetProcAddress(hModule,"LoadLibraryA"); //FARPROC pfThread = GetProcAddress(GetModuleHandleA("Kernel32.dll"),"LoadLibraryA"); LPTHREAD_START_ROUTINE pfThread = (LPTHREAD_START_ROUTINE)0x74F1A270;// QLibrary mylib("C:\\Windows\\System32\\kernel32.dll");// if(mylib.load())// {// LPFNDLLFUN hLoadLibrary = (LPFNDLLFUN)mylib.resolve("LoadLibraryA");// qDebug()<<hLoadLibrary;// } DWORD dwThreadID; HANDLE hThread = CreateRemoteThread(hProHandle,NULL,0,(LPTHREAD_START_ROUTINE)pfThread,IpAdrr,0,&dwThreadID); //qDebug()<<dwThreadID; //qDebug()<<pfThread; WaitForSingleObject(hThread,INFINITE); VirtualFreeEx(hProHandle,IpAdrr,0x1000,MEM_RELEASE); QMessageBox::information(this,"Success","Dll run over !");}void MainWindow::on_uninjectButton_clicked(){ qDebug()<<PrcoID; QStringList dllnameList = dllName.split("/"); //qDebug()<<dllnameList.last(); QString dllname2 = dllnameList.last(); char dllNameBuf[MAX_PATH] = {NULL}; strcpy(dllNameBuf,dllname2.toLocal8Bit().data()); //qDebug()<<dllNameBuf; HANDLE hSnap =CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, PrcoID); MODULEENTRY32 me32 = {0}; me32.dwSize = sizeof (me32); BOOL bRet = Module32First(hSnap,&me32); while(bRet) {// if(qstrcmp((char*)me32.szExePath,dllNameBuf) == 0)// {// QMessageBox::information(this,"find","ok");// }// bRet = Module32Next(hSnap,&me32); qDebug()<<QString::fromWCharArray(me32.szModule); bRet = Module32Next(hSnap,&me32); } CloseHandle(hSnap);}
下载qt inject dll 实例代码用户还喜欢
- 18480 文章数
- 500万+ 热度
作者专栏
编辑推荐
- 淡抹u2引擎,修复内容较多,物有所值
- 界域传说·经典巨作=传世单机(一键安装)
- 丸子版本(175个传世版本大集合)
- GS版本:神话公益服务端+客户端
- 图片放大工具(放大图片不模糊)
- 剪映无限制VIP版
- 传奇世界客户端下载器,史上最全传世客户端
- 传世GS20220920商业引擎注册+登录配置器 解压密码是1
- U2官方排行榜游戏网关 支持元神,支持传家宝
- GS开战传世客户端+服务端
- (淡漠夕阳)u2引擎合区工具
- 传世GS引擎消除“你的游戏客户端版本号过旧,请及时更新”提示
- 传世一机多区双线路配置器--免密码版本
- 传世凤凰登陆器劫持修复软件
- SQLite3 for Navicat
- 传奇世界npc对话框编辑工具
- 传世GS落霞铭文服务器端
- gs_20210409引擎包+注册机(无限制)
- 传奇世界NPC对话封包查看器[支持时长版和极速版]
- 彩虹引擎传世脚本编辑工具1.7版来了,支持函数脚本翻译
评论